<template >
	<view class="main">
		<view>{{name}}</view>
		<textarea placeholder="备注:" class="inp"  @blur="bindTextAreaBlur">
		</textarea>
		<button type="primary" @click="submit()">{{items[sta]}}</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				id:'',
				name:'',
				//items:[{'value':'0','name':'未处理'},{'value':'1','name':'处理中'},{'value':'2','name':'已处理'}],
				items:['未处理','处理中','已处理'],
				sta:0,
				value:''
			}
		},
		methods: {
			submit(){
				console.log(this.id+this.name+this.sta+this.value);
				let that = this;
				uni.getStorage({
					key:'token',
					success(e){
						that.token = e.data;
					}
				})
				uni.request({
				    url: this.$baseUrl+'devMsg/handle', //仅为示例，并非真实接口地址。
					 method :'POST',
					 header:{
						 'content-type':'application/x-www-form-urlencoded'
					 },
				    data: {'msgIds':that.id,'remark':that.value,'status':that.sta,'token':that.token},
				    success: function(res) {
						console.log(res.code);
						uni.showToast({
						    title: '保存成功!',
						    duration: 2000
						});
						uni.navigateBack();
				    }
				})
			},
			onClick(e) {
			            console.log('radio发送选择改变，携带值为', e.target.value)
						this.sta = e.target.value;
			},
			bindTextAreaBlur(e){
				 console.log(e.detail.value)
				 this.value = e.detail.value
			}
		},
		 onLoad: function (option) { //option为object类型，会序列化上个页面传递的参数
		        console.log(option.id); //打印出上个页面传递的参数。
		        console.log(option.name); //打印出上个页面传递的参数。
				console.log(option.status);
				uni.setNavigationBarTitle({title: option.name});
				this.id = option.id;
				this.name = option.name;
				this.sta = option.status;
				this.sta = parseInt(this.sta)+1;
				console.log(this.sta);
		    }
	}
</script>

<style>
	.main {
		border: 50;
		padding: 50rpx;
		height: 500rpx;
	}
	.inp{
		border: #000000;
		border-width: 5rpx;
		border-style: solid;
		border-radius: 50rpx;
		padding: 20rpx;
		background-color: #ebeaea;
	}


</style>
